package com.zan.kuangshen;

/**
 * @Author Zan
 * @Create 2024/4/20 15:58
 * @Description :
 */
public class Car {
    public static void main(String[] args) {
        // 模板反射对象
        // 类是模板，对象是具体的
        Class<Car> carClass = Car.class;

        // 名字在栈里面（栈是引用地址），具体对象在堆里面
        Car car1 = new Car();
        Car car2 = new Car();
        Car car3 = new Car();

        System.out.println(car1.hashCode());
        System.out.println(car2.hashCode());
        System.out.println(car3.hashCode());

        Class<? extends Car> aClass1 = car1.getClass();
        Class<? extends Car> aClass2 = car2.getClass();
        Class<? extends Car> aClass3 = car3.getClass();

        System.out.println(aClass1.hashCode());
        System.out.println(aClass2.hashCode());
        System.out.println(aClass3.hashCode());

        ClassLoader classLoader1 = aClass1.getClassLoader();
        System.out.println(classLoader1); // AppClassLoader

        System.out.println(classLoader1.getParent()); // ExtClassLoader  \jre\lib\ext

        System.out.println(classLoader1.getParent().getParent()); // null 1.不存在，2.java程序获取不到 ~ rt.jar

    }
}
